package com.winning.devops.batch.reader.ch04.writer;

import com.winning.devops.batch.reader.ch04.domain.Customer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chensj
 * @date 2020-03-01 21:25
 */
@Component("xmlFileItemReaderDemoItemWriter")
public class XmlFileItemReaderDemoItemWriter implements ItemWriter<Customer> {
    /**
     * logger
     */
    private static final Logger logger = LoggerFactory.getLogger(XmlFileItemReaderDemoItemWriter.class);

    @Override
    public void write(List<? extends Customer> list) throws Exception {
        logger.info("list size {}", list.size());
        if (list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                logger.info("info obj ： {}", list.get(i));
            }
        }
    }
}
